const express = require('express')
const tokenChecker = require('../util/tokenChecker')
const cartController = require('../controller/cartController')

const cartRouter = express.Router()

cartRouter.post('/modify', tokenChecker, async (req, res, next) => {
  const { memberId, goodId, count } = req.body
  try {
    await cartController.modifyGoodsOfCart(memberId, goodId, count)
    res.json({ status: 200, msg: '更改购物车成功', data: {} })
  } catch (e) {
    next(e)
  }
})
module.exports = cartRouter
